package com.element.music.service.converter;

import cn.hutool.core.bean.BeanUtil;
import com.element.music.repository.entity.collection.CollectionEntity;
import com.element.music.repository.entity.user.UserEntity;
import com.element.music.service.dto.CollectionDTO;
import com.element.music.service.dto.UserDTO;

/**
 * 功能描述：
 * <p>
 * User: nft musician developer
 * Date: 2022/1/12
 */

public class UserConverter {

    public static UserDTO entity2Dto(UserEntity userEntity) {
        if (userEntity == null) {
            return new UserDTO();
        }
        UserDTO userDTO = BeanUtil.copyProperties(userEntity, UserDTO.class);
        userDTO.setUserId(userEntity.getId());
        return userDTO;
    }

    public static UserEntity dto2Entity(UserDTO userDTO) {
        return BeanUtil.copyProperties(userDTO, UserEntity.class);
    }

}
